import http from "../request.js";

// 查看管理员列表
export function selectAllAdmins(data) {
  return http.request({
    url: "/admin/controller/selectAllAdmins",
    method: "post",
    data,
  });
}
// 查询所有操作日志
export function selectAllLogByDto(data) {
  return http.request({
    url: "/admin/controller/selectAllLogByDto",
    method: "post",
    data,
  });
}

// 权限列表查看
export function selectAllPermissions() {
  return http.request({
    url: "/admin/controller/selectAllPermissions",
    method: "get",
  });
}
// 查看管理员详情

export function selectOneAdmins(id) {
  return http.request({
    url: "/admin/controller/selectOneAdmins?id=" + id,
    method: "get",
  });
}

// 某个权限查看

export function selectOnePermissions(id) {
  return http.request({
    url: "/admin/controller/selectOnePermissions?id=" + id,
    method: "get",
    data: id,
  });
}

// 管理人员关闭
export function upOrDownAdmin(id) {
  return http.request({
    url: "/admin/controller/upOrDownAdmin?id=" + id,
    method: "get",
    data: id,
  });
}

// 某个角色人员查看
export function lookRole(id) {
  return http.request({
    url: "/admin/controller/role?id=" + id,
    method: "get",
    data: id,
  });
}

// 角色删除
export function deleteRole(id) {
  return http.request({
    url: "/admin/controller/deleteRole?id=" + id,
    method: "get",
    data: id,
  });
}
// 权限删除

export function deletePermissions(id) {
  return http.request({
    url: "/admin/controller/deletePermissions?id=" + id,
    method: "get",
    data: id,
  });
}

// 管理人员删除
export function deleteAdmins(id) {
  return http.request({
    url: "/admin/controller/deleteAdmins?id=" + id,
    method: "get",
    data: id,
  });
}

// 添加和修改角色

export function createOrUpdateRoles(data) {
  return http.request({
    url: "/admin/controller/createOrUpdateRoles",
    method: "post",
    data: data,
  });
}

// 查看所有角色

export function allRoles() {
  return http.request({
    url: "/admin/controller/allRoles",
    method: "post",
  });
}

// 新增和修改管理员

export function addOrUpdateAdmins(data) {
  return http.request({
    url: "/admin/controller/addOrUpdateAdmins",
    method: "post",
    data: data,
  });
}

// 权限添加和修改
export function addAndUpdatePermissions(data) {
  return http.request({
    url: "/admin/controller/addAndUpdatePermissions",
    method: "post",
    data: data,
  });
}
